#define TYPE_SENTINELLE -2
#define TYPE_UNDEF -1
#define TYPE_INT 0
#define TYPE_FLOAT 1
#define TYPE_STRING 2
#define TYPE_BOOLEAN 3
#define TYPE_FUNCTION 4
#define TYPE_VOID 5

#define TYPE_NON_ELSE 6
#define TYPE_ELSE 7

#define CALCULABLE 1
#define NON_CALCULABLE 0

#define OUT stdout

#define NO_REG -1

#define MAX_LINE_SIZE 512

struct sdc {
  char * code;
  struct sdc * prec;
  int type_else;
};

struct exprs {
  struct var ** vars;
  int nb;
};

struct var {
  char * nom;
  int r; // Numéro du registre
  union{
    int i;
    float f;
    char *s;
  }u;
  int type;
  struct var * prec;
  char calculable;
  char * code;
};

struct table {
  struct var * glob;
  struct var * loc;
  struct var * var_tmp;
  struct sdc * st;
};

struct sdc * affectation(struct var *, const struct var *);
struct var * expr(const struct var *, const struct var *, const char *, const char *, int, float, int , int*, char);
int bool_comp_int (int,int,const char *);
int bool_comp_float (float,float,const char *);
struct var * init_id (struct table *, const char *,int*);
struct var * charger_var (const struct var *, int *r);
struct table * init_table (void);
struct sdc * init_sdc(void);
struct var * creer_var (const char *,int);
struct var * creer_var_void(void);
struct var * creer_var_int (const char *,int,int,char);
struct var * creer_var_float(const char *,float,int,char);
struct var * creer_var_string(const char *,const char *,int);
struct var * creer_sentinelle(void);
void ajouter_glob(struct table *,struct var *);
void ajouter_loc(struct table *,struct var *);
void ajouter_tmp(struct table *,struct var *);
void ajouter_sdc(struct table *,struct sdc *);
struct var * exists_glob(struct table *,const char *);
struct var * exists_loc(struct table *,const char *);
void depiler(struct table *);
void depiler_bloc(struct table *);
void supprimer_table(struct table *);
void supprimer_var(struct var *);
void supprimer_sdc(struct sdc *);
void concatener(char **,const char *);

struct exprs * init_exprs(void);
void ajouter_expr(struct exprs *, struct var *);
void supprimer_exprs(struct exprs *);
struct var * function_print(const char *, const struct exprs *, int *);
